﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DecoratorPattern.GeneralDemo
{
    /// <summary>
    ///  抽象裝飾者
    /// </summary>
    public abstract class Decorator : Component
    {
        private Component component = null;

        /// <summary>
        /// 通過構造函數傳遞被修飾者
        /// </summary>
        /// <param name="_component"></param>
        public Decorator(Component _component)
        {
            this.component = _component;
        }

        /// <summary>
        /// 委託給被修飾者執行
        /// </summary>
        /// <returns></returns>
        public override string operate()
        {
            return this.component.operate();
        }
    }
}
